<%--
  Created by IntelliJ IDEA.
  User: song
  Date: 2021/10/25
  Time: 4:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>通过ID自动填写</title>
</head>
    <script type="text/javascript" src="js/jquery-1.8.0.min.js"></script>
    <script type="text/javascript">
        $(function (){
            $("#userId").blur(function (){
                var userId = $(this).val();
                $.post("/getById","userId=" + userId,function (user){
                    user =eval("("+user+")");
                    $("#userName").val(user.username);
                    $("#passWord").val(user.password);
                });
            });
        })

    </script>
<body>
    <h1>通过ID自动填写</h1>
    userId:<input type="text" id="userId" >
    userName:<input type="text" id="userName">
    passWord:<input type="text" id="passWord">
</body>
</html>
